package com.power.sifa.std.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
*  次级分类的申请所需材料实体类
*/

@Entity
@ApiModel(value="次级分类的申请所需材料")
@Data
@Table(name="Std_matter_attach_second",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Std_matter_attach_second.Std_matter_attach_secondPK.class) 用于复合组件
public class Std_matter_attach_second extends BaseModel implements Serializable {

	private static final long serialVersionUID = 1L;

    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "序号")
    private String id;

    @Column(nullable = false)
    @ApiModelProperty(value = "事项id")
    private String matid;

    @Column(nullable = false)
    @ApiModelProperty(value = "次级分类")
    private String type;

    @Column(nullable = false)
    @ApiModelProperty(value = "引用标准材料id")
    private String stdattachid;

    @Column(nullable = false)
    @ApiModelProperty(value = "是否必传")
    private Integer require;

    /**
     *  是否必传文本
     */
    @Transient
    @FieldEnumText(eum="yesNo", valuefield="require")
    private String require_text;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("matid", this.getMatid());
        map.put("type", this.getType());
        map.put("stdattachid", this.getStdattachid());
        map.put("require_text", this.require_text);
        map.put("require", this.getRequire());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Std_matter_attach_secondPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Std_matter_attach_secondPK pk = (Std_matter_attach_secondPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}
